package com.mumulx.check;

import com.mumulx.check.redis.RedisUtil;
import com.mumulx.check.server.ExecuteChecker;
import lombok.extern.slf4j.Slf4j;
import nxopen.Validation;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;

/*
 *  Created by IntelliJ IDEA.
 *  User: 木木
 *  Date: 2020/10/28
 *  Time: 21:46
 */
@RunWith(SpringRunner.class)
@SpringBootTest
@Slf4j
public class TEst {
    @Resource
    RedisUtil redisUtil;

    @Test
    public void testRedisPut(){
        Map<Integer, String> map = new HashMap<>();
        map.put(11, "sssss//nnn/mm.xml");

        redisUtil.set("testRedis",map,12, TimeUnit.DAYS);

    }
    @Test
    public void testRedisGet(){

        //Map<Integer, String> testRedis = (Map<Integer, String>)redisUtil.get("testRedis");

        String talkLove = (String)redisUtil.get("talkLove");

        //log.info(testRedis);
        System.out.println(talkLove);

    }

    @Resource
    ExecuteChecker executeChecker;
    @Value("${nx.partdownloadpath}")
    private String partDownloadPath;

    @Test
    public void testNXCheckPartPath(){
        String filePath=partDownloadPath+"9\\119\\";
        File file = new File(filePath);
        System.out.println(filePath);
        if (!file.exists()) {
            file.mkdirs();
        }
    }
    @Test
    public void testNXCheckPart(){
        String filePath=partDownloadPath+"9\\118\\";

        System.out.println(filePath);
        List<String> parts = new ArrayList<>();
        parts.add(filePath+"278");
        //parts.add("D:\\workplace\\nxdownload\\9\\101\\255");
        //parts.add("D:\\workplace\\nxdownload\\9\\101\\256");
        List<String> rules = new ArrayList<>();
        //rules.add("D:\\workplace\\nxdownload\\9\\101\\254");
        //rules.add("D:\\workplace\\nxdownload\\9\\101\\255");
        rules.add("mqc_check_multi_cat_layer");

        //int execute = executeChecker.execute(parts,rules , filePath);


    }
}
